angular.module('payModule', [])
    .controller('payCtr', ['$scope', '$location', function ($scope, $location) {
        $scope.total = LsySession.getItem('totalPrice');
        $scope.goBack = function () {
            window.history.back();
        };
        $scope.payNow = function () {
            var num = parseInt(Math.random() * 10);
            var orderData = LsyStorage.getItem('orderDatas');
            orderData = orderData ? orderData : [];
            var confirmOrderData=LsyStorage.getItem('confirmOrderDatas');
            if (num % 2 == 1) {
                angular.forEach(confirmOrderData,function(item){
                    item.status=1;
                    orderData.push(item);
                });
                $location.path('payS');
            } else {
                angular.forEach(confirmOrderData,function(item){
                    item.status=0;
                    orderData.push(item);
                });
                $location.path('payF');
            }
            LsyStorage.setItem('orderDatas',orderData);
        }
    }]);
